From e229cff8def84a502c31f63bbbdcc87935ad4a78 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?= =?utf8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= Date: Fri, 28 Mar 2014 12:50:51 +0000 Subject: [PATCH] W32: Fix listbox selection * Makes listbox background white instead of default grey * Uses gradients or W32 theme parts to draw sexy selection/prelight rectangle instead of changing selected/prelighted item background * Removes blanket button text color, allowing buttons to inherit text color from their parents. Non-normal buttons DO get specific text color though. This partially fixes text color propagation from listbox rows to their children. https://bugzilla.gnome.org/show_bug.cgi?id=727244 --- gtk/resources/theme/gtk-win32-base.css | 11 ++++++-- gtk/resources/theme/gtk-win32-xp.css | 39 ++++++++++++++++++++++++++ gtk/resources/theme/gtk-win32.css | 21 ++++++++++++++ 3 files changed, 68 insertions(+), 3 deletions(-) diff --git a/gtk/resources/theme/gtk-win32-base.css b/gtk/resources/theme/gtk-win32-base.css index d621178fbf..5b8b00d203 100644 --- a/gtk/resources/theme/gtk-win32-base.css +++ b/gtk/resources/theme/gtk-win32-base.css @@ -123,7 +123,6 @@ GtkAssistant .sidebar .highlight { /* Buttons */ .button { - color: -gtk-win32-color(button, 18); background-color: transparent; background-image: -gtk-win32-theme-part(button, 1 1); border-width: 0; @@ -143,11 +142,12 @@ GtkAssistant .sidebar .highlight { .button:prelight, .button:prelight:focused { background-image: -gtk-win32-theme-part(button, 1 2); - color: #000000; + color: @text_color; } .button:active, .button:active:focused, .button:active:focused:prelight { background-image: -gtk-win32-theme-part(button, 1 3); + color: @text_color; } /* Check buttons */ @@ -858,7 +858,7 @@ column-header .button:active:prelight:focus { GtkSwitch { font: bold condensed 10; - color: -gtk-win32-color(button, 18); + color: @text_color; } GtkSwitch.slider { @@ -1326,3 +1326,8 @@ GtkPopover > .view, GtkPopover > .toolbar { background-color: transparent; } + +/* Listbox */ +.list { + background-color: -gtk-win32-color(listbox, 5); +} diff --git a/gtk/resources/theme/gtk-win32-xp.css b/gtk/resources/theme/gtk-win32-xp.css index ff61e9d97e..68ccba5ef7 100644 --- a/gtk/resources/theme/gtk-win32-xp.css +++ b/gtk/resources/theme/gtk-win32-xp.css @@ -123,3 +123,42 @@ GtkProgressBar.progressbar { .notebook tab:active.left { padding: 4px 1px 4px 4px; } + +/* Listbox */ + +/* This is roughly similar to what Vista+ theme draws. The reason for using +this instead of changing background-color to @selection_bg_color is that +blanket "* { color: @text_color; }" style overrides ".list-row:selected { +color: @selected_fg_color; }", causing labels and widgets in list rows to have +black (not white) text over blue background. Fixing that requires overhauling +the whole theme to put narrow "color: @text_color" style everywhere, to be +able to remove the blanket style. +And the reason for not using appropriate W32 theme part is that the appropriate +W32 theme part does not exist in XP theme. */ +.list-row:prelight { + background-image: -gtk-gradient (linear, + 0 0, 0 1, + color-stop(0, rgb(253, 254, 255)), + color-stop(1, rgb(237, 245, 255))); + box-shadow: inset -1px -1px 0px rgba (128, 128, 255, 0.5), inset 1px 1px 0px rgba (128, 128, 255, 0.5); +} + +.list-row:selected { + /* Override *:selected {} blanket style, keeping the background - bright + and the text - dark */ + background-color: transparent; + color: @text_color; + background-image: -gtk-gradient (linear, + 0 0, 0 1, + color-stop(0, rgb(236, 244, 255)), + color-stop(1, rgb(208, 230, 255))); + box-shadow: inset -1px -1px 0px rgba (128, 128, 255, 0.5), inset 1px 1px 0px rgba (128, 128, 255, 0.5); +} + +.list-row:selected:prelight { + background-image: -gtk-gradient (linear, + 0 0, 0 1, + color-stop(0, rgb(221, 236, 255)), + color-stop(1, rgb(194, 220, 255))); + box-shadow: inset -1px -1px 0px rgba (128, 128, 255, 0.5), inset 1px 1px 0px rgba (128, 128, 255, 0.5); +} \ No newline at end of file diff --git a/gtk/resources/theme/gtk-win32.css b/gtk/resources/theme/gtk-win32.css index f812e4dc66..ce76a2ba02 100644 --- a/gtk/resources/theme/gtk-win32.css +++ b/gtk/resources/theme/gtk-win32.css @@ -317,3 +317,24 @@ /* Make active tab "stick out" left by padding it more at the right */ padding-right: 4px; } + + +/* Listbox */ + +/* We're cheating here, using part 6 (listview header group), + because part 1 (listview item) is empty for some reason */ +.list-row:prelight { + background-image: -gtk-win32-theme-part(listview, 6 10); +} + +.list-row:selected { + /* Override *:selected {} blanket style, keeping the background - bright + and the text - dark */ + background-color: transparent; + color: @text_color; + background-image: -gtk-win32-theme-part(listview, 6 11); +} + +.list-row:selected:prelight { + background-image: -gtk-win32-theme-part(listview, 6 12); +} -- 2.30.2